pub mod interfaces;
pub mod logger;
pub mod workflow;
pub mod phase;
pub mod tasks;

use workflow::Workflow::Workflow;
use phase::Phase::Phase;
use tasks::TaskDefinitions::Task;
use tasks::FailureDefinitions::Failure;
use logger::Logger::PrintLogger;

use std::rc::Rc;


fn main() {
    let mut workflow: Workflow = Workflow {
        _phases: vec![
            Rc::new(Phase {
                _tasks: vec![
                    Rc::new(Task {
                        _signature: "Network Check.",
                    }),
                    Rc::new(Task {
                        _signature: "RHEL Version Check.",
                    }),
                    Rc::new(Task {
                        _signature: "RPM Check.",
                    }),
                ],
                _signature: "Environment Check.",
            }),
            Rc::new(Phase {
                _tasks: vec![
                    Rc::new(Task {
                        _signature: "Rpm upgrade."
                    }),
                    Rc::new(Task {
                        _signature: "Initramfs generation."
                    }),
                    Rc::new(Task {
                        _signature: "Reboot system."
                    }),
                    Rc::new(Task {
                        _signature: "Resume services."
                    }),
                    Rc::new(Task {
                        _signature: "Remove resume services."
                    }),
                ],
                _signature: "Processing system."
            }),
            Rc::new(Phase {
                _tasks: vec![
                    Rc::new(Task {
                        _signature: "Initialize hardware.",
                    }),
                    Rc::new(Failure {
                        _signature: "Update configuration.",
                    })
                ],
                _signature: "System Configuration."
            }),
        ],
        _signature: "system migration",
        _logger: Box::new(PrintLogger {}),
        _description: "System in-place migration.",
        _phase_done: vec![],
        _current_phase: None,
        _tasks_processed: vec![],
        _tasks_ready: vec![],
        _revert: true,
    };

    workflow.start();
}
